package com.note.services;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import com.note.bean.Note;
import com.note.dao.NoteDao;

public class NoteServices {  
	private  NoteDao noteDao=new NoteDao();
	SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	public void saveOrUpDateNote(Note note) { 
		Note dbnote=noteDao.getNoteByDate(note.getDate());
		if (dbnote!=null) {
			System.out.println("dbnote.getId()"+dbnote.getId());
			note.setId(dbnote.getId());
			noteDao.upDate(note);
		}else {
			noteDao.saveNote(note);
		}
		
	} 
	public Note getNoteByDate(Date date){ 
		return noteDao.getNoteByDate(date);
	}
	public int creatTable_Note(){ 
		return noteDao.creatTable_Note();
	}
  

}
